package com.flurry.android;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Looper;
import android.text.TextUtils;
import java.io.File;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class FlurryDataSenderIndex
{
  private static Integer eB = Integer.valueOf(50);
  private HashMap<String, List<String>> eC;
  private ExecutorService eD;
  private Context mContext = null;

  public FlurryDataSenderIndex(Context paramContext, String paramString)
  {
    this.mContext = paramContext;
    this.eD = Executors.newSingleThreadExecutor();
    this.eC = new HashMap();
    if (!TextUtils.equals(paramString, this.mContext.getSharedPreferences("flurry_data_sender_preferences", 0).getString("flurry_data_sender_preferences", "")))
    {
      discardOutdatedBlocksForDataKey(paramString);
      SharedPreferences.Editor localEditor = this.mContext.getSharedPreferences("flurry_data_sender_preferences", 0).edit();
      localEditor.putString("flurry_data_sender_preferences", paramString);
      localEditor.commit();
    }
    while (true)
    {
      if (this.eC.get(paramString) == null)
      {
        LinkedList localLinkedList = new LinkedList();
        this.eC.put(paramString, localLinkedList);
      }
      return;
      List localList = o(paramString);
      this.eC.put(paramString, localList);
    }
  }

  private void a(String paramString, List<String> paramList)
  {
    this.eD.submit(new q(this, paramString, paramList));
  }

  // ERROR //
  private boolean b(String paramString, List<String> paramList)
  {
    // Byte code:
    //   0: iconst_0
    //   1: istore_3
    //   2: aload_0
    //   3: monitorenter
    //   4: invokestatic 123	android/os/Looper:myLooper	()Landroid/os/Looper;
    //   7: invokestatic 126	android/os/Looper:getMainLooper	()Landroid/os/Looper;
    //   10: if_acmpne +10 -> 20
    //   13: ldc 128
    //   15: ldc 130
    //   17: invokestatic 136	com/flurry/android/cy:d	(Ljava/lang/String;Ljava/lang/String;)V
    //   20: aload_0
    //   21: getfield 29	com/flurry/android/FlurryDataSenderIndex:mContext	Landroid/content/Context;
    //   24: new 138	java/lang/StringBuilder
    //   27: dup
    //   28: invokespecial 139	java/lang/StringBuilder:<init>	()V
    //   31: ldc 141
    //   33: invokevirtual 145	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   36: aload_1
    //   37: invokevirtual 145	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   40: invokevirtual 149	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   43: invokevirtual 153	android/content/Context:getFileStreamPath	(Ljava/lang/String;)Ljava/io/File;
    //   46: astore 5
    //   48: aload 5
    //   50: invokestatic 158	com/flurry/android/an:a	(Ljava/io/File;)Z
    //   53: istore 10
    //   55: iload 10
    //   57: ifne +11 -> 68
    //   60: aconst_null
    //   61: invokestatic 163	com/flurry/android/fl:a	(Ljava/io/Closeable;)V
    //   64: aload_0
    //   65: monitorexit
    //   66: iload_3
    //   67: ireturn
    //   68: new 165	java/io/DataOutputStream
    //   71: dup
    //   72: new 167	java/io/FileOutputStream
    //   75: dup
    //   76: aload 5
    //   78: invokespecial 170	java/io/FileOutputStream:<init>	(Ljava/io/File;)V
    //   81: invokespecial 173	java/io/DataOutputStream:<init>	(Ljava/io/OutputStream;)V
    //   84: astore 7
    //   86: aload 7
    //   88: aload_2
    //   89: invokeinterface 179 1 0
    //   94: invokevirtual 183	java/io/DataOutputStream:writeShort	(I)V
    //   97: iconst_0
    //   98: istore 11
    //   100: iload 11
    //   102: aload_2
    //   103: invokeinterface 179 1 0
    //   108: if_icmpge +79 -> 187
    //   111: aload_2
    //   112: iload 11
    //   114: invokeinterface 186 2 0
    //   119: checkcast 188	java/lang/String
    //   122: invokevirtual 192	java/lang/String:getBytes	()[B
    //   125: astore 12
    //   127: aload 12
    //   129: arraylength
    //   130: istore 13
    //   132: ldc 128
    //   134: new 138	java/lang/StringBuilder
    //   137: dup
    //   138: invokespecial 139	java/lang/StringBuilder:<init>	()V
    //   141: ldc 194
    //   143: invokevirtual 145	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   146: iload 11
    //   148: invokevirtual 197	java/lang/StringBuilder:append	(I)Ljava/lang/StringBuilder;
    //   151: ldc 199
    //   153: invokevirtual 145	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   156: iload 13
    //   158: invokevirtual 197	java/lang/StringBuilder:append	(I)Ljava/lang/StringBuilder;
    //   161: invokevirtual 149	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   164: invokestatic 202	com/flurry/android/cy:e	(Ljava/lang/String;Ljava/lang/String;)V
    //   167: aload 7
    //   169: iload 13
    //   171: invokevirtual 183	java/io/DataOutputStream:writeShort	(I)V
    //   174: aload 7
    //   176: aload 12
    //   178: invokevirtual 206	java/io/DataOutputStream:write	([B)V
    //   181: iinc 11 1
    //   184: goto -84 -> 100
    //   187: aload 7
    //   189: iconst_0
    //   190: invokevirtual 183	java/io/DataOutputStream:writeShort	(I)V
    //   193: iconst_1
    //   194: istore 9
    //   196: aload 7
    //   198: invokestatic 163	com/flurry/android/fl:a	(Ljava/io/Closeable;)V
    //   201: iload 9
    //   203: istore_3
    //   204: goto -140 -> 64
    //   207: astore 8
    //   209: aconst_null
    //   210: astore 7
    //   212: ldc 128
    //   214: ldc 52
    //   216: aload 8
    //   218: invokestatic 209	com/flurry/android/cy:b	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
    //   221: aload 7
    //   223: invokestatic 163	com/flurry/android/fl:a	(Ljava/io/Closeable;)V
    //   226: iconst_0
    //   227: istore 9
    //   229: goto -28 -> 201
    //   232: aload 7
    //   234: invokestatic 163	com/flurry/android/fl:a	(Ljava/io/Closeable;)V
    //   237: aload 6
    //   239: athrow
    //   240: astore 4
    //   242: aload_0
    //   243: monitorexit
    //   244: aload 4
    //   246: athrow
    //   247: astore 6
    //   249: goto -17 -> 232
    //   252: astore 8
    //   254: goto -42 -> 212
    //   257: astore 6
    //   259: aconst_null
    //   260: astore 7
    //   262: goto -30 -> 232
    //
    // Exception table:
    //   from	to	target	type
    //   48	55	207	java/lang/Throwable
    //   68	86	207	java/lang/Throwable
    //   4	20	240	finally
    //   20	48	240	finally
    //   60	64	240	finally
    //   196	201	240	finally
    //   221	226	240	finally
    //   232	240	240	finally
    //   86	97	247	finally
    //   100	181	247	finally
    //   187	193	247	finally
    //   212	221	247	finally
    //   86	97	252	java/lang/Throwable
    //   100	181	252	java/lang/Throwable
    //   187	193	252	java/lang/Throwable
    //   48	55	257	finally
    //   68	86	257	finally
  }

  private boolean n(String paramString)
  {
    return new FlurryDataSenderBlockInfo(this.mContext, paramString).deletePersistentData();
  }

  // ERROR //
  private List<String> o(String paramString)
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore_2
    //   2: aload_0
    //   3: monitorenter
    //   4: invokestatic 123	android/os/Looper:myLooper	()Landroid/os/Looper;
    //   7: invokestatic 126	android/os/Looper:getMainLooper	()Landroid/os/Looper;
    //   10: if_acmpne +10 -> 20
    //   13: ldc 128
    //   15: ldc 219
    //   17: invokestatic 136	com/flurry/android/cy:d	(Ljava/lang/String;Ljava/lang/String;)V
    //   20: aload_0
    //   21: getfield 29	com/flurry/android/FlurryDataSenderIndex:mContext	Landroid/content/Context;
    //   24: new 138	java/lang/StringBuilder
    //   27: dup
    //   28: invokespecial 139	java/lang/StringBuilder:<init>	()V
    //   31: ldc 141
    //   33: invokevirtual 145	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   36: aload_1
    //   37: invokevirtual 145	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   40: invokevirtual 149	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   43: invokevirtual 153	android/content/Context:getFileStreamPath	(Ljava/lang/String;)Ljava/io/File;
    //   46: astore 4
    //   48: aload 4
    //   50: invokevirtual 224	java/io/File:exists	()Z
    //   53: istore 5
    //   55: iload 5
    //   57: ifeq +205 -> 262
    //   60: new 226	java/io/DataInputStream
    //   63: dup
    //   64: new 228	java/io/FileInputStream
    //   67: dup
    //   68: aload 4
    //   70: invokespecial 229	java/io/FileInputStream:<init>	(Ljava/io/File;)V
    //   73: invokespecial 232	java/io/DataInputStream:<init>	(Ljava/io/InputStream;)V
    //   76: astore 7
    //   78: aload 7
    //   80: invokevirtual 235	java/io/DataInputStream:readUnsignedShort	()I
    //   83: istore 11
    //   85: iload 11
    //   87: ifne +12 -> 99
    //   90: aload 7
    //   92: invokestatic 163	com/flurry/android/fl:a	(Ljava/io/Closeable;)V
    //   95: aload_0
    //   96: monitorexit
    //   97: aload_2
    //   98: areturn
    //   99: new 237	java/util/ArrayList
    //   102: dup
    //   103: iload 11
    //   105: invokespecial 239	java/util/ArrayList:<init>	(I)V
    //   108: astore 6
    //   110: iconst_0
    //   111: istore 12
    //   113: iload 12
    //   115: iload 11
    //   117: if_icmpge +81 -> 198
    //   120: aload 7
    //   122: invokevirtual 235	java/io/DataInputStream:readUnsignedShort	()I
    //   125: istore 14
    //   127: ldc 128
    //   129: new 138	java/lang/StringBuilder
    //   132: dup
    //   133: invokespecial 139	java/lang/StringBuilder:<init>	()V
    //   136: ldc 241
    //   138: invokevirtual 145	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   141: iload 12
    //   143: invokevirtual 197	java/lang/StringBuilder:append	(I)Ljava/lang/StringBuilder;
    //   146: ldc 199
    //   148: invokevirtual 145	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   151: iload 14
    //   153: invokevirtual 197	java/lang/StringBuilder:append	(I)Ljava/lang/StringBuilder;
    //   156: invokevirtual 149	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   159: invokestatic 202	com/flurry/android/cy:e	(Ljava/lang/String;Ljava/lang/String;)V
    //   162: iload 14
    //   164: newarray byte
    //   166: astore 15
    //   168: aload 7
    //   170: aload 15
    //   172: invokevirtual 244	java/io/DataInputStream:readFully	([B)V
    //   175: aload 6
    //   177: new 188	java/lang/String
    //   180: dup
    //   181: aload 15
    //   183: invokespecial 246	java/lang/String:<init>	([B)V
    //   186: invokeinterface 250 2 0
    //   191: pop
    //   192: iinc 12 1
    //   195: goto -82 -> 113
    //   198: aload 7
    //   200: invokevirtual 235	java/io/DataInputStream:readUnsignedShort	()I
    //   203: pop
    //   204: aload 7
    //   206: invokestatic 163	com/flurry/android/fl:a	(Ljava/io/Closeable;)V
    //   209: aload 6
    //   211: astore_2
    //   212: goto -117 -> 95
    //   215: astore 17
    //   217: aconst_null
    //   218: astore 7
    //   220: aconst_null
    //   221: astore 6
    //   223: aload 17
    //   225: astore 9
    //   227: ldc 128
    //   229: ldc 252
    //   231: aload 9
    //   233: invokestatic 209	com/flurry/android/cy:b	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
    //   236: aload 7
    //   238: invokestatic 163	com/flurry/android/fl:a	(Ljava/io/Closeable;)V
    //   241: goto -32 -> 209
    //   244: astore_3
    //   245: aload_0
    //   246: monitorexit
    //   247: aload_3
    //   248: athrow
    //   249: astore 10
    //   251: aconst_null
    //   252: astore 7
    //   254: aload 7
    //   256: invokestatic 163	com/flurry/android/fl:a	(Ljava/io/Closeable;)V
    //   259: aload 10
    //   261: athrow
    //   262: ldc 128
    //   264: ldc 254
    //   266: invokestatic 202	com/flurry/android/cy:e	(Ljava/lang/String;Ljava/lang/String;)V
    //   269: aconst_null
    //   270: astore 6
    //   272: goto -63 -> 209
    //   275: astore 10
    //   277: goto -23 -> 254
    //   280: astore 8
    //   282: aload 8
    //   284: astore 9
    //   286: aconst_null
    //   287: astore 6
    //   289: goto -62 -> 227
    //   292: astore 9
    //   294: goto -67 -> 227
    //
    // Exception table:
    //   from	to	target	type
    //   60	78	215	java/lang/Throwable
    //   4	20	244	finally
    //   20	55	244	finally
    //   90	95	244	finally
    //   204	209	244	finally
    //   236	241	244	finally
    //   254	262	244	finally
    //   262	269	244	finally
    //   60	78	249	finally
    //   78	85	275	finally
    //   99	110	275	finally
    //   120	192	275	finally
    //   198	204	275	finally
    //   227	236	275	finally
    //   78	85	280	java/lang/Throwable
    //   99	110	280	java/lang/Throwable
    //   120	192	292	java/lang/Throwable
    //   198	204	292	java/lang/Throwable
  }

  public void addBlockInfo(FlurryDataSenderBlockInfo paramFlurryDataSenderBlockInfo, String paramString)
  {
    String str = paramFlurryDataSenderBlockInfo.getIdentifier();
    List localList = (List)this.eC.get(paramString);
    if (localList == null)
      cy.g("FlurryDataSenderIndex", "New Data Key");
    for (Object localObject = new LinkedList(); ; localObject = localList)
    {
      ((List)localObject).add(str);
      if (((List)localObject).size() > eB.intValue())
      {
        n((String)((List)localObject).get(0));
        ((List)localObject).remove(0);
      }
      this.eC.put(paramString, localObject);
      a(paramString, (List)localObject);
      return;
    }
  }

  public boolean discardOutdatedBlocksForDataKey(String paramString)
  {
    if (Looper.myLooper() == Looper.getMainLooper())
      cy.d("FlurryDataSenderIndex", "discardOutdatedBlocksForDataKey(ID) running on the MAIN thread!");
    File localFile = this.mContext.getFileStreamPath(".FlurrySenderIndex.info." + paramString);
    List localList1 = (List)this.eC.get(paramString);
    if (localList1 == null);
    do
    {
      return false;
      List localList2 = getNotSentBlocksForDataKey(paramString);
      for (int i = 0; i < localList2.size(); i++)
        n((String)localList2.get(i));
      localList1.clear();
      this.eC.put(paramString, localList1);
    }
    while ((localFile == null) || (!localFile.exists()));
    if (localFile.delete())
    {
      cy.c("FlurryDataSenderIndex", "Deleted persistence file");
      return true;
    }
    cy.d("FlurryDataSenderIndex", "Cannot delete persistence file");
    return false;
  }

  public List<String> getNotSentBlocksForDataKey(String paramString)
  {
    return (List)this.eC.get(paramString);
  }

  public boolean removeBlockInfoWithIdentifier(String paramString1, String paramString2)
  {
    List localList = (List)this.eC.get(paramString2);
    if (localList == null)
      return false;
    n(paramString1);
    boolean bool = localList.remove(paramString1);
    this.eC.put(paramString2, localList);
    if (!bool)
      return false;
    a(paramString2, localList);
    return true;
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.flurry.android.FlurryDataSenderIndex
 * JD-Core Version:    0.6.2
 */